<template>
    <div>
        <el-dialog :title="title" :visible.sync="dialogVisible" width="500px">
      <el-form class="demo-form-inline" label-width="80px">
        <el-form-item label="冻结原因">
          <el-input v-model="data.lockReason" />
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="submit()">提 交</el-button>
      </span>
    </el-dialog>
    </div>
</template>

<script>
import apiUser from '@/api/baseManager/user'
export default {
  name:'dialogFrozen',
  data(){
     return{
         dialogVisible:false,
         title:'', //后面的名字
         data:{
            id:'',
            lockReason:'', //冻结原因
            userState:4, //状态
         }
     }
  },
  methods:{
      //定义的冻结的方法
      open(row){
          this.data = row
          this.title = "冻结用户--" +row.userName //表头显示用户名字
          apiUser.get(row.userId).then(res=>{
            let e = res.data.item;
            this.data = {
              userId : e.userId,
              userState:4,
              logoutReason :e.logoutReason
            }
          })
          this.dialogVisible = true
      },
      submit(){
         apiUser.update(this.data).then(res=>{
           this.$parent.getList(); //调用父组件的方法 刷新表格
           this.dialogVisible = false
         })
      }
  }
}
</script>

<style scoped>

</style>